package com.corpgovernment.organization.enumm;


import com.ctrip.corp.obt.generic.utils.StringUtils;

import java.util.Arrays;

public enum MbImportExcelRecordTypeEnum {
    ORG("ORG", "组织导入"),
    EMP("EMP", "人员导入");
    private String code;

    private String desc;

    MbImportExcelRecordTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getTypeName(String code) {
        if (StringUtils.isEmpty(code)) {
            return null;
        }
        MbImportExcelRecordTypeEnum recordTypeEnum = Arrays.stream(MbImportExcelRecordTypeEnum.values()).filter(x -> x.getCode().equals(code)).findFirst().orElse(null);
        if (recordTypeEnum == null) {
            return null;
        }
        return recordTypeEnum.getDesc();
    }
}
